/*
 * @Author: Jimmy
 * @LastModifiedBy: Jimmy
 * @Date: 2024-05-23 20:23:01
 * @LastEditTime: 2024-05-24 00:03:25
 * @FilePath: /nest_study/src/config/index.ts
 */
import { readFileSync } from 'fs';
import * as yaml from 'js-yaml';
import { join } from 'path';

const configFileNameObj = {
    development: 'dev',
    test: 'test',
    production: 'prod',
};

const env = process.env.NODE_ENV || 'development';
console.log(process.env.NODE_ENV);

export default () => {
    const filePath:string = join(__dirname, `./${configFileNameObj[env]}.yml`);
    const data = readFileSync(filePath, 'utf8');
    return yaml.load(data) as Record<string, any>;
};